//
//  YYT_LoginViewController.m
//  AudioVisualFeast
//
//  Created by dllo on 16/2/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QL_LoginViewController.h"

@interface QL_LoginViewController ()
@property (weak, nonatomic) IBOutlet UITextField *yonghuming;
@property (weak, nonatomic) IBOutlet UITextField *mima;

@end

@implementation QL_LoginViewController : UIViewController

- (IBAction)quxiao:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
}
- (IBAction)denglu:(id)sender {
    [BmobUser loginWithUsernameInBackground:self.yonghuming.text password:self.mima.text block:^(BmobUser *user, NSError *error) {
        if (user) {
            [self dismissViewControllerAnimated:YES completion:nil];
        }else{
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"用户名或密码错误!" preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleCancel handler:nil];
            [alert addAction:cancelAction];
            [self presentViewController:alert animated:YES completion:^{
                
                
            }];
        }
    }];

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationController.navigationBarHidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
